#include <stdio.h>
#include <dlfcn.h>

int main(int argc, char * argv[])
{
	if (argc != 2) {
		printf("Usage:%s whattoprint\n", argv[0]);
		return 0;
	}

	void * slam_handle;
	void (*print_func)(char * str);

	slam_handle = dlopen("slam.so", RTLD_LAZY);
	if (!slam_handle) {
		printf("dlopen failed.\n");
		return -1;
	}

	print_func = (void (*)(char*))dlsym(slam_handle, "print");
	if (dlerror() != NULL) {
		printf("dlsym failed.\n");
		return -1;
	}

	(*print_func)(argv[1]);

	return 0;
}
